<h1><%= title "Select Character" %></h1>
<!-- 
<%= @territory %>
<%= @title_choice %>
<%= @sex %>
-->
<form action="select_character" method="get">
	<table>
		<tr>
			<th colspan="3" valign="center">Filter Available Characters</th>
		</tr>
		<tr>
			<th>Realm</th>
			<th>Title</th>
			<th>Sex</th>
			<th></th>
		</tr>
		<tr>
			<td>
				<select name="realm">
					<%= options_realm_select @realm %>
				</select>
			</td>
			<td>
				<select name="title">
					<%= options_title_categories_and_sub_categories @title_choice %>
				</select>
			</td>
			<td>
				<select name="sex">
					<%= options_character_sex @sex %>
				</select>
			</td>
			<td>
				<input type="submit" value="Filter">
				<input type="submit" name="clear" value="Clear">
			</td>
		</tr>
	</table>
</form>

<div id="characters">
	<table>
		<tr>
			<th>Character</th>
			<th>Liege</th>
			<th>Age</th>
			<th>Prestige</th>
			<th>Wealth</th>
			<th>Piety</th>
			<th>Traits</th>
			<th></th>
		</tr>
		<% for character in @characters %>
		<tr>
			<td><%=link_to_record character%></td>
			<td><%=link_to_record character.liege%></td>
			<td><%=character.age%></td>
			<td><%=character.prestige%></td>
			<td><%=character.wealth%></td>
			<td><%=character.piety%></td>
			<td><%=character_traits character %></td>
			<td>
				<form action="choose_character" method="get">
					<input type="hidden" name="character_id" value="<%=character.id%>"/>
					<input type="submit" value="Choose"/>
				</form>
			</td>
		</tr>
		<% end %>
	</table>
</div>